//
//  FunnyViewController.swift
//  DouYuZB
//
//  Created by wangpeng on 2017/4/10.
//  Copyright © 2017年 鼎商动力. All rights reserved.
//

import UIKit
private let topMargin: CGFloat = 10
class FunnyViewController: BaseAnchorViewController {
    
    fileprivate lazy var funnyVM:FunnyViewModel = FunnyViewModel()
}

//MARK: - 设置 UI
extension FunnyViewController{
    override func setupUI() {
        super.setupUI()
        let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
        layout.headerReferenceSize = CGSize.zero
        collectionView.contentInset = UIEdgeInsets(top: topMargin, left: 0, bottom: 0, right: 0)
    }
}
//MARK: - 请求数据
extension FunnyViewController{
    override func loadData() {
        //1.给父类Viewmodel赋值
        baseVM = funnyVM
        
        funnyVM.loadFunnyDate {
            //2.刷新数据
            self.collectionView.reloadData()
            
            //3.数据请求完成
            self.loadDataFinish()
        }
    }
}
